namespace HelpDesk.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class RemovedRequiredAttrFromActivity : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.Activities", "Ticket_TicketID", "dbo.Tickets");
            DropForeignKey("dbo.Activities", "Customer_UserId", "dbo.UserProfile");
            DropIndex("dbo.Activities", new[] { "Ticket_TicketID" });
            DropIndex("dbo.Activities", new[] { "Customer_UserId" });
            AlterColumn("dbo.Activities", "Ticket_TicketID", c => c.Int());
            AlterColumn("dbo.Activities", "Customer_UserId", c => c.Int());
            AddForeignKey("dbo.Activities", "Ticket_TicketID", "dbo.Tickets", "TicketID");
            AddForeignKey("dbo.Activities", "Customer_UserId", "dbo.UserProfile", "UserId");
            CreateIndex("dbo.Activities", "Ticket_TicketID");
            CreateIndex("dbo.Activities", "Customer_UserId");
        }
        
        public override void Down()
        {
            DropIndex("dbo.Activities", new[] { "Customer_UserId" });
            DropIndex("dbo.Activities", new[] { "Ticket_TicketID" });
            DropForeignKey("dbo.Activities", "Customer_UserId", "dbo.UserProfile");
            DropForeignKey("dbo.Activities", "Ticket_TicketID", "dbo.Tickets");
            AlterColumn("dbo.Activities", "Customer_UserId", c => c.Int(nullable: false));
            AlterColumn("dbo.Activities", "Ticket_TicketID", c => c.Int(nullable: false));
            CreateIndex("dbo.Activities", "Customer_UserId");
            CreateIndex("dbo.Activities", "Ticket_TicketID");
            AddForeignKey("dbo.Activities", "Customer_UserId", "dbo.UserProfile", "UserId", cascadeDelete: true);
            AddForeignKey("dbo.Activities", "Ticket_TicketID", "dbo.Tickets", "TicketID", cascadeDelete: true);
        }
    }
}
